#!/bin/bash
# wrfpost_pdf2png.sh

if [ $# -lt 1 ]; then
    echo "Input arguments number must equal 1. QUITING."
    exit 1
else
    inpath=$1
    cd $inpath
    for ifile in ${inpath}/*.pdf
    do
        echo $ifile
        xpath=${ifile%/*} 
        xbase=${ifile##*/}
        xpref=${xbase%.*}
        echo $xpref
        gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m -r200 -sOutputFile=$xpref.png $ifile
    done
fi
